package com.mz.mattress.client.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mz.mattress.api.common.Result;
import com.mz.mattress.api.entity.OrderUseTimesBonus;
import com.mz.mattress.client.api.req.OrderUseRecordBonusQueryReq;
import com.mz.mattress.client.mapper.OrderUseTimesBonusMapper;
import com.mz.mattress.client.service.OrderUseTimesBonusService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class OrderUseTimesBonusServiceImpl implements OrderUseTimesBonusService {

    @Autowired
    private OrderUseTimesBonusMapper orderUseTimesBonusMapper;

    @Override
    public Result<IPage<OrderUseTimesBonus>> listPage(OrderUseRecordBonusQueryReq req) {
        IPage<OrderUseTimesBonus> listpage = orderUseTimesBonusMapper.listPage(req.newPage(),
                req.getMonths(), req.getDates(), req.getMemberId(), req.getMerchantId());
        return Result.ok(listpage);
    }

    @Override
    public Result<OrderUseTimesBonus> getById(Integer id) {
        OrderUseTimesBonus record = orderUseTimesBonusMapper.selectById(id);
        return Result.ok(record);
    }

}
